<html>
    <head><title>quickSearch</title></head>
    <body>
    <form action="/admin/quickSearch" method="post">
        <input type="text" name="searchString"{% if posted %} value = "{{searchString}}"{% endif %}>
        <input type="submit" value="Search"><input type="radio" name="searchFor" value="tas" checked>tas<input type="radio" name="searchFor" value="sections"{% if posted and not ta %}checked{% endif %}>sections
        {{semesters}}
        [ <a href="/admin/advSearch">advanced search</a> ]
    </form>
    <style>
        #taresults{
            font-size: 12px;
        }
        #taresult{
            float: left;
            padding: 10px 10px 10px 10px;
            margin: 10px 0px 0px 0px;
            border: 2px solid;
        }
        #name{
            float: left;
            width: 100%;
            font-size: 16px;
            font-wdight: bold;
            padding: 0px;
            margin: 0px;
        }
        #basicInfo{
            float: left;
            padding: 0px 0px 0px 12px;
        }
        #specializations{
            float: left;
            text-align: center;
            padding: 0px 0px 0px 12px;
        }
        #history{
            float:left;
            text-align: center;
            padding: 0px 0px 0px 12px;
        }
        #assigned{
            float:left;
            text-align: center;
            padding: 0px 0px 0px 12px;
        }
        #languages{
            float:left;
            text-align: center;
            padding: 0px 0px 0px 12px;
        }
    </style>
        {% if posted %}
            {% if validSearch %}
                <!--Search for {{searchFor}} in {{searchSemester}} semester was valid.-->
                {% if ta %}
                    {% if empty %}
                        The search returned no results.</br>
                    {% else %}
                        <div id = "taresults">
                            {% for result in results %}
                                <div id="taresult">
                                    <div id="name">
                                        {{ result.firstName }} {{ result.lastName }} - {{ result.eid }}
                                    </div>
                                    <div id="basicInfo">
                                        <b>Phone:</b> {{ result.phone }}
                                        <br />
                                        <b>Email:</b> {{ result.email }}
                                        <br />
                                        <b>Major:</b> {{ result.major.name }} - {{ result.degree }}
                                        <br />
                                        <b>Native English:</b> {% if result.nativeEnglish %} Yes {% else %} No {% endif %}
                                        <br />
                                        <b>Supervising Professor:</b> {{ result.supervisor }}
                                    </div>
                                    <div id="specializations">
                                        {% if result.taSpecializations.count %}
                                            <b>Specializations:</b>
                                            <br />
                                            {% for taSpecialization in result.taSpecializations %}
                                                {{ taSpecialization.specialization.name }}
                                                <br />
                                            {% endfor %}
                                        {% endif %}
                                    </div>
                                    <div id="history">
                                        {% if result.taTaHistory.count %}
                                            <b>History:</b>
                                            <br />
                                            {% for taHistory in result.taTaHistory %}
                                                {{ taHistory.taHistory.name }}
                                                <br />
                                            {% endfor %}
                                        {% endif %}
                                    </div>	
                                    <div id="assigned">
                                        {% if result.taSections.count %}
                                            <b>Assigned to:</b>
                                            <br />
                                            {% for taSection in result.taSections %}
                                                {{ taSection.section.uniqueNumber }} - {{ taSection.section.course.name }}
                                                <br />
                                            {% endfor %}
                                        {% endif %}
                                    </div>
                                    <div id="languages">
                                        {% if result.taLanguages.count %}
                                            <b>Languages:</b>
                                            <br />
                                            {% for taLanguage in result.taLanguages %}
                                                {{ taLanguage.language.name }}
                                                <br />
                                            {% endfor %}
                                        {% endif %}
                                    </div>
                                </div>
                            {% endfor %}	
                        </div>
                    {% endif %}
                {% else %}
                    {% if empty %}
                        The search returned no results.</br>
                    {% else %}
                        <table ID="resultTable" border="1">
                            <tr><th>Course Name</th><th>Unique Number</th><th>Instructor</th><th>Number of Students</th><th>Number of TAs</th><td align="center"></td></tr>
                            {% for r in results %}
                                <tr><td>{{r.course.identifier}} - {{r.course.name}}</td><td name = "unique" >{{r.uniqueNumber}}<td>{{r.instructor.lastName}}, {{r.instructor.firstName}}</td><td>{{r.numStudents}}</td><td>{{r.numTas}}</td><td></tr>
                            {% endfor %}
                        </table>
                    {% endif %}
                {% endif %}
            {% else %}
                Must enter at least one character to search for {{searchFor}}. Blank not accepted.
            {% endif %}
            <br />
        {% endif %}
    </body>
</html>